<!DOCTYPE html>
<html lang='zh-CN'>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>驿站提现订单表</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.min.css" rel="stylesheet">
    <link href="js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <div><h4>佣金提现</h4></div>
                    <div id="toolbar" class="toolbar-btn-action">
                        <form class="form-inline" method="post" id="searchForm" action="/remote/commwithdraw/getExcel">
                            <div class="form-group">
                                <label>驿站名称:</label>
                                <input type="text" class="form-control" name="stationName">
                            </div>
                            <div class="form-group">
                                <label>会员账号:</label>
                                <input type="text" class="form-control" name="memberId">
                            </div>
<!--                            <div class="form-group">-->
<!--                                <label>订单号:</label>-->
<!--                                <input type="text" class="form-control" name="outTradeNo">-->
<!--                            </div>-->
                            <div class="form-group">
                                <label>创建时间:</label>
                                <input type="text" class="form-control js-datepicker" data-date-format="yyyy-mm-dd" name="startTime" placeholder="开始时间" style="width:120px;"> -
                                <input type="text" class="form-control js-datepicker" data-date-format="yyyy-mm-dd" name="endTime" placeholder="结束时间" style="width:120px;">
                            </div>
                            <div class="form-group">
                                <label>申请状态:</label>
                                <select name="orderStatus" class="form-control">
                                    <option value="">全部</option>
                                    <option value="0">未审核</option>
                                    <option value="1">审核通过</option>
                                    <option value="2">审核拒绝</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-info btn_query btn-round" type="button" id="searchFormBtn">查询</button>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-success btn_query btn-round"  type="button" id="examinationPassedBtn">审核提现通过</button>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-danger btn_query btn-round"  type="button" id="RefundRefusedBtn">审核退款拒绝</button>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-secondary btn_query btn-round" type="button" id="generate-excel">导出商品数据</button>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="card-body">
                    <table id="list_data"></table>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/bootstrap-table/bootstrap-table.js"></script>
    <script type="text/javascript" src="js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
    <script type="text/javascript" src="js/zero2one/zero2one.version.js"></script>
    <script type="text/javascript" src="js/zero2one/zero2one.core.js"></script>
    <!-- bootstrap表单验证插件 -->
    <script type="text/javascript" src="js/bootstrap-validator-master/dist/validator.js"></script>
    <!-- jquery-form表单提交插件 -->
    <script type="text/javascript" src="js/jquery-form/jquery.form.js"></script>
    <!-- bootstrap弹出框插件 -->
    <script type="text/javascript" src="js/jquery.bootstrap.min.js"></script>
    <!-- 表单填充插件 -->
    <script type="text/javascript" src="js/jquery-form/jquery.formloader.js"></script>
    <!--日期选择插件-->
    <script src="js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
    <script src="js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
    <script type="text/javascript" src="js/main.min.js"></script>

    <script type="text/javascript">

        //设置表头
        var columns = [
            {checkbox: true},
            {field: 'id',title: '订单id',visible:false},
            {field: 'stationName',title: '驿站名称'},
            {field: 'memberNick',title: '站长名称'},
            {field: 'memberId',title: '会员账号'},
            {field: 'outTradeNo',title: '订单号'},
            {field: 'openId',title: '会员openId',visible:false},
            {field: 'creationTime',title: '创建时间', formatter: function (value) {
                    return zero2one.dateFormat(value, 'Y-m-d H:i:s')
                }},
            {field: 'orderStatus',title: '申请状态',formatter: function (value, row, index) {
                    if (value==0) {
                        return "<button class=\"btn btn-warning btn-sm\">未审核</button>";
                    }else if(value==1){
                        return  "<button class=\"btn btn-success btn-sm\">审核通过</button>";
                    }else if(value==2){
                        return  "<button class=\"btn btn-danger btn-sm\">审核拒绝</button>";
                    }
                }},
            {field: 'exchangeRate',title: '汇率',visible:false},
            {field: 'messageLog',title: '拒绝原因',formatter: function (value) {
                    if (value==null || value==''){
                        return "无";
                    }else {
                        return value;
                    }
                },visible:false},
            {field: 'withdrawalPrice',title: '实际提现金额',formatter: function (value) {
                        return  value+"元";
                }},
            {field: 'auditor',title: '审核人',formatter: function (value) {
                    if (value==null || value==''){
                        return "暂未审核";
                    }else {
                        return value;
                    }
                }},
            {field: 'type',title: '佣金提现',formatter: function (value, row, index) {
                 if(value==0){
                        return  "小程序";
                    }else if(value==1){
                        return  "app";
                    }
                }},
            {field: 'approveTime',title: '审核时间', formatter: function (value) {
                    if (value==null || value==''){
                        return "无";
                    }else {
                        return zero2one.dateFormat(value, 'Y-m-d H:i:s')
                    }

                }}
        ];
        //进入主界面加载数据
        zero2one.datagrid("list_data", "/remote/commwithdraw/list",function (params) {
            return $.extend(zero2one.tableInitParam(params), zero2one.form2json("searchForm"));
        }, columns);

        //点击查询按钮重新加载页面数据
        $("#searchFormBtn").click(function () {
            $('#list_data').bootstrapTable('refresh');
        });


        //点击审核退款通过按钮
        $("#examinationPassedBtn").click(function () {
            //获取选中行的数据
            var datas = $('#list_data').bootstrapTable('getSelections');
            if(datas.length ==1){
                $.messager.confirm("温馨提示", "您是否要审核通过?", function () {
                    $.post("/remote/commwithdraw/transfer", {"withdrawId" : datas[0].id},
                        function(data){
                            if (data.success) {
                                $.messager.alert("温馨提示", "您已审核成功");
                                window.location.reload();
                            } else {
                                $.messager.alert("温馨提示", data.msg);

                            }
                        }, "json");
                })
            }else{
                $.messager.alert("温馨提示", "请选择一条数据操作");

            }
        });



        //点击审核退款拒绝按钮
        $("#RefundRefusedBtn").click(function () {
            //获取选中行的数据
            var datas = $('#list_data').bootstrapTable('getSelections');
            if(datas.length ==1){
                $.messager.confirm("温馨提示", "您是否要拒绝审核?", function () {
                    $.post("/remote/commwithdraw/refuse", {"withdrawId" : datas[0].id},
                        function(data){
                            if (data.success) {
                                $.messager.alert("温馨提示", "您已审核成功");
                                window.location.reload();
                            } else {
                                $.messager.alert("温馨提示", data.msg);

                            }
                        }, "json");
                })
            }else{
                $.messager.alert("温馨提示", "请选择一条数据操作");

            }
        });


        //导出商品数据按钮
        $("#generate-excel").click(function(){
            $.messager.confirm("提示", "您是否要导出所的数据?", function () {
                $("#searchForm").submit();
            });
        });


    </script>
</div>
</body>
</html>
